QT       += core gui widgets

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11
CONFIG += debug_and_release

RC_ICONS = images/clock.ico

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    cdisplayinfo.cpp \
    chook.cpp \
    cruntimesetting.cpp \
    cscreenprotectordlg.cpp \
    cscreenprotectormag.cpp \
    cscreenprotectorpreviewdlg.cpp \
    ctimespanintvalidator.cpp \
    main.cpp \
    maindialog.cpp

HEADERS += \
     cdisplayinfo.h \
     chook.h \
     cnoncopy.h \
     common.h \
     cruntimesetting.h \
     cscreenprotectordlg.h \
     cscreenprotectordlg.h \
     cscreenprotectormag.h \
     cscreenprotectorpreviewdlg.h \
     ctimespanintvalidator.h \
     maindialog.h

FORMS += \
     cscreenprotectordlg.ui \
     maindialog.ui

MOC_DIR = $$OUT_PWD\moc
OBJECTS_DIR = $$OUT_PWD\obj
RCC_DIR = $$OUT_PWD\rcc
BINARY = $${TARGET}.exe
WINDEPLOYQT = "windeployqt.exe"


win32{

    MT_X64 = \"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\mt.exe\"
    MT_X86 = \"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\mt.exe\"

    CONFIG(debug,debug|release){
        #QMAKE_PRE_LINK += if not exist  \"$${OUT_PWD}\debug\fonts\" (mkdir \"$${OUT_PWD}\debug\fonts\") &&
        #QMAKE_PRE_LINK += copy /y  \".\fonts\"   \"$${OUT_PWD}\debug\fonts\" &&
        #QMAKE_PRE_LINK += if not exist  \"$${OUT_PWD}\debug\images\" (mkdir \"$${OUT_PWD}\debug\images\") &&
        #QMAKE_PRE_LINK += copy /y \".\images\" \"$${OUT_PWD}\debug\images\" &&
        #QMAKE_PRE_LINK += copy /y \".\app.manifest\" \"$${OUT_PWD}\debug\"

       # QMAKE_PRE_LINK += $$quote(D:\Qt\Qt5.14.2\projects\ScreenProtect\qmake_pre_link.bat)

    contains(QT_ARCH, i386) {
        message("32-bit")
            QMAKE_POST_LINK += $$MT_X86  -manifest  \"$${OUT_PWD}\debug\app.manifest\"  -outputresource:\"$${OUT_PWD}\debug\\$${BINARY}\";$${LITERAL_HASH}1

        } else {
            message("64-bit")
            QMAKE_POST_LINK += $$MT_X64  -manifest  \"$${OUT_PWD}\debug\app.manifest\"  -outputresource:\"$${OUT_PWD}\debug\\$${BINARY}\";$${LITERAL_HASH}1
        }

    } else {
        contains(QT_ARCH, i386) {
            message("32-bit")
            QMAKE_POST_LINK += $$MT_X86  -manifest  \"$${OUT_PWD}\release\app.manifest\"  -outputresource:\"$${OUT_PWD}\release\\$${BINARY}\";$${LITERAL_HASH}1
        } else {
            message("64-bit")
            QMAKE_POST_LINK += $$MT_X64  -manifest  \"$${OUT_PWD}\release\app.manifest\"  -outputresource:\"$${OUT_PWD}\release\\$${BINARY}\";$${LITERAL_HASH}1
        }
    }
}

#LIBS += -luser32

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
    images.qrc
